class Solution {
public:
    ListNode* oddEvenList(ListNode* head) {
        if (head == nullptr) return head;
        ListNode* cur1 = head;
        ListNode* cur2 = head->next;
        ListNode* nodecur2 = cur2;
        while (cur2 != nullptr && cur2->next != nullptr) {
            cur1->next = cur2->next;
            cur1 = cur1->next;
            cur2->next = cur1->next;
            cur2 = cur2->next;
        }
        cur1->next = nodecur2;
        return head;
    }
}; 